import trade from "@/store/trade";
import ajax from "./ajax";
import mockAjax from "./mockAjax";

// 获取三级导航数据 的接口函数
export const reqGetCategoryListData = ()=> ajax.get('/product/getBaseCategoryList')

// 获取轮播图的接口函数
export const reqGetBannerListData = ()=>mockAjax.get('/bannerList')

// 获取楼层数据的接口函数
export const reqGetFloorsListData = ()=>mockAjax.get('/floors')

// 获取搜索商品数据
export const reqSearchGoodsInfoData = (searchParams) => ajax.post('/list',searchParams)

// 获取商品详情数据
export const reqGoodsDetailInfoData = (id) => ajax.get('/item/'+id)

// 添加购物车请求
export const reqAddOrUpdataCart = (skuId,skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)

// 获取购物车数据
export const reqShopCartListData = () => ajax.get('/cart/cartList')

// 更新购物车选中状态
export const reqUpdateShopCartListData = (skuId,isChecked) => ajax.get(`/cart/checkCart/${skuId}/${isChecked}`)

// 批量更新购物车商品选中状态
export const reqChangeAllCartState = (isChecked,skuIdList) => ajax({
    url:`/cart/batchCheckCart/${isChecked}`,
    method:'post',
    data:skuIdList
})

// 删除购物车一条商品数据
export const reqDelOneShopCartGoods = skuId => ajax.delete(`cart/deleteCart/${skuId}`)

// 批量删除购物车商品
export const reqDelManyShopCartGoods = skuIdList =>ajax.post('/cart/batchDeleteCart',skuIdList)

// 获取手机验证码
export const reqVerifyCode = phone=>ajax.get(`/user/passport/sendCode/${phone}`)

// 注册账号
export const reqUserRegister = user => ajax.post("/user/passport/register",user)

// 实现登录
export const reqUserLogin = user => ajax.post('/user/passport/login',user)

// 登出
export const reqLogout = () => ajax.get('/user/passport/logout')

// 获取邮寄地址
export const reqGetUserAddressList = () => ajax.get('/user/userAddress/auth/findUserAddressList')

// 获取订单数据
export const reqTradeInfoData = () => ajax.get('/order/auth/trade')

// 提交订单
export const reqSubmitTradeOrder = (tradeNo,params)=>ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,params)

// 获取支付二维码
export const reqGetPayQRcode = (orderId)=>ajax.get(`/payment/weixin/createNative/${orderId}`)

// 查询支付订单状态 是否成功支付
export const reqPayStatus = (orderId)=> ajax.get(`/payment/weixin/queryPayStatus/${orderId}`)